package com.example.emos.api.service.impl;

import com.example.emos.api.common.util.PageUtils;
import com.example.emos.api.db.dao.TbBusinessDao;
import com.example.emos.api.db.dao.TbTattooDao;
import com.example.emos.api.db.pojo.TbBusiness;
import com.example.emos.api.service.BusinessService;
import com.example.emos.api.service.TattooService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;

@Service
public class BusinessServiceImpl implements BusinessService {
    @Autowired
    private TbBusinessDao tbBusinessDao;
    @Override
    public ArrayList<HashMap> searchAllBusiness() {
        ArrayList<HashMap> list = tbBusinessDao.searchAllBusiness();
        return list;
    }

    @Override
    public int insertBusiness(TbBusiness business) {
        int row = tbBusinessDao.insertBusiness(business);
        return row;
    }
    @Override
    public PageUtils searchBusinessByPage(HashMap param) {
        ArrayList<HashMap> list= tbBusinessDao.searchBusinessByPage(param);
        long count=tbBusinessDao.searchBusinessCount(param);
        int start=(Integer) param.get("start");
        int length=(Integer) param.get("length");
        PageUtils pageUtils=new PageUtils(list,count,start,length);
        return pageUtils;
    }

    @Override
    public int insertBusinessMore(ArrayList<TbBusiness> businessList) {
        return tbBusinessDao.insertBusinessMore(businessList);
    }

    @Override
    public int updateBusinessByGlobalId(TbBusiness business) {
        return tbBusinessDao.updateBusinessByGlobalId(business);
    }
}
